package com.example.blogindex.web;

import com.example.blogindex.web.Fengin.OtherFengin;
import com.xpd.blog.bean.Favorite;
import com.xpd.blog.bean.Result;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("favorite")
public class FavoriteController {
    @Autowired
    OtherFengin otherFengin;
    @RequestMapping("selectFav")
    public Result selectFav(@RequestParam int usid, @RequestParam int aid){
        Result result = otherFengin.selectFav(usid, aid);
        return result;
    }
    @RequestMapping("addFav")
    public Result addFav(@RequestParam int usid,@RequestParam int aid){
        Result result = otherFengin.addFav(usid, aid);
        return result;
    }
    @RequestMapping("delFav")
    public Result delFav(@RequestParam int usid,@RequestParam int aid){
        Result result = otherFengin.delFav(usid, aid);
        return result;
    }

    //查看自己的收藏
    @RequestMapping("getFav")
    public Result getFav(@RequestParam int usid, @RequestParam("page")int page, @RequestParam("size")int size){
        Result fav = otherFengin.getFav(usid,page,size);
        return fav;
    }
}
